package com.zhongyu.scheduler.provider.apiimpl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zhongyu.comm.api.SchedulerApi;
import com.zhongyu.comm.api.SchedulerSeatPriceApi;
import com.zhongyu.comm.pojo.Scheduler;
import com.zhongyu.comm.pojo.SchedulerSeatPrice;
import com.zhongyu.scheduler.provider.mapper.SchedulerSeatPriceMapper;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class SchedulerSeatPriceApilmpl implements SchedulerSeatPriceApi {

    @Resource
    private SchedulerSeatPriceMapper schedulerSeatPriceMapper;


    @Override
    public List<SchedulerSeatPrice> findBySchedulerId(Integer scheduleId) {
        QueryWrapper<SchedulerSeatPrice> queryWrapper= Wrappers.query();
        queryWrapper.eq("schedule_Id",scheduleId);
        return schedulerSeatPriceMapper.selectList(queryWrapper);
    }

    @Override
    public SchedulerSeatPrice findPrice(Integer scheduleId, Integer areaLevel) {
        QueryWrapper<SchedulerSeatPrice> wrapper=Wrappers.query();
        wrapper.eq("schedule_id",scheduleId);
        wrapper.eq("area_level",areaLevel);
       return  schedulerSeatPriceMapper.selectOne(wrapper);
    }
}
